package com.sun.service.ums.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sun.pojo.UmsMenu;
import com.sun.mapper.ums.UmsMenuMapper;
import com.sun.service.ums.IUmsMenuService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 后台菜单表 服务实现类
 * </p>
 *
 * @author 妙妙屋
 * @since 2021-12-13
 */
@Service
public class UmsMenuServiceImpl extends ServiceImpl<UmsMenuMapper, UmsMenu> implements IUmsMenuService {
        @Autowired
        private UmsMenuMapper umsMenuMapper;
    @Override
    public IPage<UmsMenu> selectPage(Long pageId, Long pageNum, Long pageSize) {
        Page<UmsMenu> page = new Page<>(pageNum, pageSize);
        QueryWrapper<UmsMenu> wra = new QueryWrapper<>();
        wra.eq("parent_id",pageId);
        return umsMenuMapper.selectPage(page,wra);
    }

    @Override
    public List<UmsMenu> getTreeList() {
        return umsMenuMapper.getTreeList();
    }
}
